﻿/// <reference path="../jquery-1.4.4-vsdoc.js" />

$.mask = {
    current: null,
    show: function (config)
    {
        $.mask.clear();

        var _mask = $(String.format("<div class=\"maskclass\"></div>"));

        $(document.body).append(_mask);
        $(window).bind("resize", $.mask.resize);
        $.mask.current = _mask;
        $(window).trigger("resize");
    },
    clear: function ()
    {
        $(".maskclass").remove();
        $.mask.current = null;
        $(window).unbind("resize", $.mask.resize);
    },
    resize: function (event, mask)
    {

        var isStrict = document.compatMode == "CSS1Compat";

        function w(isStrict)
        {
            var w = isStrict ? document.documentElement.scrollWidth : document.body.scrollWidth;
            return Math.max(w, $(window).width());
        }

        function h(isStrict)
        {
            var h = isStrict ? document.documentElement.scrollHeight : document.body.scrollHeight;
            return Math.max(h, $(window).height());
        }

        if ($.mask.current)
        {
            $.mask.current.css({ width: w(isStrict), height: h(isStrict) });
        }
    }
};